import App from './App'
import cuCustom from "@/components/CuCustom.vue"
import ColorList from "@/assets/js/common.js"
import { router } from "./router/index.ts"
import "@/utils/prototype.js"

// #ifndef VUE3
import Vue from 'vue'
import './uni.promisify.adaptor'
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
  ...App
})
app.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'

export function createApp() {
  const app = createSSRApp(App)
	app.component("cu-custom", cuCustom)
	app.config.globalProperties.ColorList = ColorList
	
	const e = uni.getSystemInfoSync()
	// #ifdef H5
	app.config.globalProperties.StatusBar = e.statusBarHeight
	if (e.platform == 'android') {
		app.config.globalProperties.CustomBar = e.statusBarHeight + 50
	} else {
		app.config.globalProperties.CustomBar = e.statusBarHeight + 45
	}
	// #endif
	
	// #ifdef MP-WEIXIN
	app.config.globalProperties.StatusBar = e.statusBarHeight
	let custom = wx.getMenuButtonBoundingClientRect()
	app.config.globalProperties.CustomBar = custom.bottom + custom.top - e.statusBarHeight
	// #endif
	
	// #ifdef MP-ALIPAY
	app.config.globalProperties.StatusBar = e.statusBarHeight;
	app.config.globalProperties.CustomBar = e.statusBarHeight + e.titleBarHeight;
	// #endif
	
  return {
    app
  }
}
// #endif